package com.ruleengine.db.service;

import java.util.List;
import java.util.Optional;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruleengine.db.model.Rulechain;
import com.ruleengine.db.model.RulechainState;
import com.ruleengine.db.model.RulechainStatus;

/**
 * @author lianghanwei on 2024/3/15
 */
public interface RulechainService extends IService<Rulechain> {

    Optional<Rulechain> getRulechain(String tenantId, String rulechainId);

    Optional<Rulechain> getRulechain(String rulechainId, int expectedMinVersion, RulechainState state);

    List<Rulechain> getRulechains(String tenantId, List<String> rulechainIds);

    boolean updateRulechainDescriptionAndTopic(String tenantId, String rulechainId, String description, String topic, int expectedVersion);

    boolean updateRulechainState(String tenantId, String rulechainId, RulechainState state, int expectedVersion);

    boolean updateRulechainStatus(String rulechainId, int expectedVersion, RulechainStatus status);

    boolean softDeleteRulechains(String tenantId, List<String> rulechainIds);

}
